<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>友情链接列表</title>
	<link rel="stylesheet" href="__PUBLIC__/Admin/Css/common.css" />
	<script type="text/javascript" src='__PUBLIC__/Admin/Js/jquery-1.8.2.min.js'></script>
	<script type="text/javascript" src='__PUBLIC__/Admin/Js/common.js'></script>
	<script type="text/javascript">
	var url = '__URL__';
	$(function(){
		$(".edit").click(function() {
			var linkname = $(this).parent("td").prev("td").prev("td").children("input[name='linkname']");
			var src = $(this).parent("td").prev("td").children("input[name='src']");
			var id = $(this).parents("tr").attr("lid");
			$.post(url+"/editLink",{linkname:linkname.val().trim(),src:src.val().trim(),id:id},function(sta){
				if(sta){
					alert("修改成功!");
				}else{
					alert("修改失败!");
				}
			},'json');
		});
	})
	</script>
</head>
<body>
	<div class='status'>
		<span>友情链接</span>
	</div>
		<table class="table">
			<tr>
				<th>友链名称</th>
				<th>友链地址</th>
				<th>操作</th>
			</tr>
			<foreach name="link" item="v">
			<tr lid="{$v.id}">
				<td>
					<input type="text" name='linkname' class='input-long' value="{$v.linkname}" />
				</td>
				<td>
					<input type="text" name='src' class='input-long' value="{$v.src}" />
				</td>
				<td>
					<div class="edit"></div>
					<a href="{:U('delLink', array('id' => $v['id']))}" class='del'></a>
				</td>
			</tr>
			</foreach>
		</table>
</body>
</html>